home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / include / assert.h < prev    next >
C/C++ Source or Header  |  1990-07-23  |  961b  |  38 lines

  1. /* The <assert.h> header contains a macro called "assert" that allows 
  2.  * programmers to put assertions in the code.  These assertions can be verified
  3.  * at run time.  If an assertion fails, an error message is printed.  
  4.  * Assertion checking can be disabled by adding the statement
  5.  *
  6.  *    #define NDEBUG
  7.  *
  8.  * to the program before the 
  9.  *
  10.  *    #include <assert.h>
  11.  *
  12.  * statement.
  13.  */
  14.  
  15. #ifdef assert
  16. #undef assert            /* make this file idempotent */
  17. #endif
  18.  
  19. #ifndef    _ANSI_H
  20. #include <ansi.h>
  21. #endif
  22.  
  23.  
  24. #ifdef NDEBUG
  25. /* Debugging disabled -- do not evaluate assertions. */
  26. #define assert(expr)  ((void) 0)
  27. #else
  28. /* Debugging enabled -- verify assertions at run time. */
  29.  
  30. #if _ANSI
  31. _PROTOTYPE( _VOID __bad_assertion, (const char *__expr, const char *__file, int __line) );
  32. #define assert(expr) ((void) ((expr) ? (void)0 : __bad_assertion( #expr, __FILE__,  __LINE__)))
  33. #else
  34. #define assert(expr) ((void) ((expr) ? 0 : __assert( __FILE__,  __LINE__)))
  35. #endif
  36.  
  37. #endif
  38.